# Contributor: William Desportes <williamdes@wdes.fr>
# Maintainer: William Desportes <williamdes@wdes.fr>
pkgname=horust
pkgver=0.1.7
pkgrel=1
pkgdesc="Horust is a supervisor / init system written in rust and designed to be run inside containers"
url="https://github.com/FedericoPonzi/Horust"
# s390x, riscv64: nix/libc crates lack support
arch="all !s390x !riscv64"
license="MIT"
makedepends="cargo cargo-auditable"
checkdepends="bash" # test_single_command uses bash
subpackages="$pkgname-doc"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/FedericoPonzi/Horust/archive/v$pkgver.tar.gz
	"
builddir="$srcdir/Horust-$pkgver"


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	# Add USER ENV for test_should_correctly_deserialize_sample test
	USER="$(whoami)" cargo test --frozen -- --skip test_termination_all_custom_signals
}

package() {
	install -Dm755 target/release/horust -t "$pkgdir"/usr/bin
	install -Dm0644 README.md -t "$pkgdir"/usr/share/doc/"$pkgname"
	install -Dm0644 DOCUMENTATION.md -t "$pkgdir"/usr/share/doc/"$pkgname"
	install -Dm0644 example_services/* -t "$pkgdir"/usr/share/doc/"$pkgname"/example_services
}

sha512sums="
caa762f9ccc14ed058732f023e0e347fbf5968d500dea3e3f30c9ba91b4f93aeaaefd4e41e434fca320b8b1416550c9f83383d7406015a3e60de8f71d85418c3  horust-0.1.7.tar.gz
"
